package dry.example.route;


import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author zc
 */
public class CustomInvocationHandler implements InvocationHandler {

    private final Object target;

    public CustomInvocationHandler(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        if ("h01".equals(method.getName())) {
            System.out.println("CustomInvocationHandler.invoke start");
            Object result = method.invoke(target, args);
            System.out.println("CustomInvocationHandler.invoke end");
            return result;
        }
        return method.invoke(target, args);
    }

}
